package edu.wit.acl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.wit.acl.entity.RoleCapacity;
import edu.wit.acl.mapper.RoleCapacityMapper;
import edu.wit.acl.service.RoleCapacityService;
import org.springframework.stereotype.Service;

@Service
public class RoleCapacityServiceImpl extends ServiceImpl<RoleCapacityMapper, RoleCapacity> implements RoleCapacityService {

    @Override
    public void saveRoleCapacity(RoleCapacity roleCapacity) {
        baseMapper.insert(roleCapacity);
    }

    @Override
    public void updateRoleCapacity(RoleCapacity roleCapacity) {
        baseMapper.updateById(roleCapacity);
    }

    @Override
    public void removeRoleCapacity(String roleId) {
        baseMapper.delete(new QueryWrapper<RoleCapacity>().eq("role_id",roleId));
    }

    @Override
    public RoleCapacity selectRoleCapacity(String roleId) {
        return baseMapper.selectOne(new QueryWrapper<RoleCapacity>().eq("role_id",roleId));
    }

    @Override
    public RoleCapacity selectRoleCapacityByUserId(String userId) {
        return baseMapper.selectRoleCapacityByUserId(userId);
    }
}
